﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QLNSClient
{
    public partial class uc_dsSaplenluong : UserControl
    {
        QLNSServiceReference.QLNSServiceClient sv = new QLNSServiceReference.QLNSServiceClient();
        
        public uc_dsSaplenluong()
        {
            InitializeComponent();
        }


       
        private void uc_dsSaplenluong_Load(object sender, EventArgs e)
        {

            //t = DateTime.Today;
            int tempT = DateTime.Today.Month;
            for (tempT = 01; tempT <= 12; tempT++)
            {
               
                cmb_Nam.Items.Add(tempT);
            }
            
            
            
            gv_dsLenluong.DataSource = sv.getSLL();
        }


        DateTime t;
        string b;
        private void cmb_Nam_SelectedIndexChanged(object sender, EventArgs e)
        {
            string a = cmb_Nam.Text;

            if (Int32.Parse(a.ToString()) < 10)
            {
                b = "0" + a;
                t = new DateTime(t.Month);
                t = DateTime.ParseExact(b, "MM", null);
                gv_dsLenluong.DataSource = sv.getSLLtheoThang(t);
            }
            else
            {
                t = new DateTime(t.Month);
                t = DateTime.ParseExact(a, "MM", null);
                gv_dsLenluong.DataSource = sv.getSLLtheoThang(t);
            }
        }

        private void btn_All_Click(object sender, EventArgs e)
        {
            gv_dsLenluong.DataSource = sv.getSLL();
            cmb_Nam.Text = "";
        }


    }
}
